<html>
<head><meta charset="utf-8"><title>Get current state being exceuted during a poll · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html">Get current state being exceuted during a poll</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="235874598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235874598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235874598">(Apr 23 2021 at 17:01)</a>:</h4>
<p>Would it be possible somehow to get a <code>&amp;'static str</code> of the current executing state during a generator poll?</p>



<a name="235878579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235878579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235878579">(Apr 23 2021 at 17:29)</a>:</h4>
<p>can you say more? not sure what you mean</p>



<a name="235880292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235880292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235880292">(Apr 23 2021 at 17:40)</a>:</h4>
<p>Ok so each generator has sub states it can be in one at a time, right?</p>



<a name="235880306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235880306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235880306">(Apr 23 2021 at 17:40)</a>:</h4>
<p>so when I poll a future and and one of those states is slow</p>



<a name="235880315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235880315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235880315">(Apr 23 2021 at 17:40)</a>:</h4>
<p>how can I capture what state that was?</p>



<a name="235880341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235880341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235880341">(Apr 23 2021 at 17:40)</a>:</h4>
<p>For debugging</p>



<a name="235880371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235880371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235880371">(Apr 23 2021 at 17:40)</a>:</h4>
<p>for the future itself I can use <code>std::any::type_name::&lt;F&gt;()</code> to capture the name of the future</p>



<a name="235880383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235880383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235880383">(Apr 23 2021 at 17:40)</a>:</h4>
<p>but not the internal state machine elements</p>



<a name="235882104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235882104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sean McArthur <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235882104">(Apr 23 2021 at 17:51)</a>:</h4>
<p>so pretending the generator state machine were an enum, you'd want something like <code>std::mem::discriminant</code> to be able to check dynamic what step it is currently "pending" at</p>



<a name="235882538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235882538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235882538">(Apr 23 2021 at 17:54)</a>:</h4>
<p>Yes, something like that</p>



<a name="235883158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235883158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235883158">(Apr 23 2021 at 17:59)</a>:</h4>
<p>it seems like what you want, <span class="user-mention" data-user-id="207781">@Lucio Franco</span>, is a <a href="https://doc.rust-lang.org/std/panic/struct.Location.html"><code>Location</code></a></p>



<a name="235884393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235884393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235884393">(Apr 23 2021 at 18:06)</a>:</h4>
<p>Yeah that works too but not for a panic I want for example a way to fill up some <code>Vec&lt;Location&gt;</code> in <code>Context</code> when we poll a future to know what state machine elements were hit</p>



<a name="235884404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235884404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235884404">(Apr 23 2021 at 18:06)</a>:</h4>
<p>during that poll cycle</p>



<a name="235893368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235893368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235893368">(Apr 23 2021 at 19:09)</a>:</h4>
<p>sure</p>



<a name="235893430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235893430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235893430">(Apr 23 2021 at 19:10)</a>:</h4>
<p>I'm just saying that a <code>Location</code> is kind of the info you are looking for, iiuc</p>



<a name="235893451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Get%20current%20state%20being%20exceuted%20during%20a%20poll/near/235893451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Get.20current.20state.20being.20exceuted.20during.20a.20poll.html#235893451">(Apr 23 2021 at 19:10)</a>:</h4>
<p>the fact that it lives in <code>std::panic</code>... well, neither here nor there perhaps</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>